﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Setting
{
	/// <summary>
	/// Summary description for LtcClrSet.
	/// </summary>
	public class LtcClrSet : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.ComboBox cboClearCntLtc;
		private System.Windows.Forms.ComboBox cboLtcMode;
		private System.Windows.Forms.ComboBox cboClrMode;
		private System.Windows.Forms.ComboBox cboClearCntClr;
		private System.Windows.Forms.Button btnReturn;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public LtcClrSet()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.cboLtcMode = new System.Windows.Forms.ComboBox();
			this.cboClearCntLtc = new System.Windows.Forms.ComboBox();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.cboClrMode = new System.Windows.Forms.ComboBox();
			this.cboClearCntClr = new System.Windows.Forms.ComboBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.btnReturn = new System.Windows.Forms.Button();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.cboLtcMode,
																					this.cboClearCntLtc,
																					this.label2,
																					this.label1});
			this.groupBox1.Location = new System.Drawing.Point(16, 15);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(296, 120);
			this.groupBox1.TabIndex = 2;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "LTC";
			// 
			// cboLtcMode
			// 
			this.cboLtcMode.Location = new System.Drawing.Point(128, 72);
			this.cboLtcMode.Name = "cboLtcMode";
			this.cboLtcMode.Size = new System.Drawing.Size(144, 23);
			this.cboLtcMode.TabIndex = 3;
			this.cboLtcMode.SelectedIndexChanged += new System.EventHandler(this.cboLtcMode_SelectedIndexChanged);
			// 
			// cboClearCntLtc
			// 
			this.cboClearCntLtc.Location = new System.Drawing.Point(128, 32);
			this.cboClearCntLtc.Name = "cboClearCntLtc";
			this.cboClearCntLtc.Size = new System.Drawing.Size(144, 23);
			this.cboClearCntLtc.TabIndex = 2;
			this.cboClearCntLtc.SelectedIndexChanged += new System.EventHandler(this.cboClearCntLtc_SelectedIndexChanged);
			// 
			// label2
			// 
			this.label2.AutoSize = true;
			this.label2.Location = new System.Drawing.Point(16, 76);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(89, 14);
			this.label2.TabIndex = 1;
			this.label2.Text = "Latch Counter :";
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(16, 36);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(88, 14);
			this.label1.TabIndex = 0;
			this.label1.Text = "Clear Counter :";
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.cboClrMode,
																					this.cboClearCntClr,
																					this.label3,
																					this.label4});
			this.groupBox2.Location = new System.Drawing.Point(16, 151);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(296, 120);
			this.groupBox2.TabIndex = 3;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "CLR";
			// 
			// cboClrMode
			// 
			this.cboClrMode.Location = new System.Drawing.Point(128, 72);
			this.cboClrMode.Name = "cboClrMode";
			this.cboClrMode.Size = new System.Drawing.Size(144, 23);
			this.cboClrMode.TabIndex = 5;
			this.cboClrMode.SelectedIndexChanged += new System.EventHandler(this.cboClrMode_SelectedIndexChanged);
			// 
			// cboClearCntClr
			// 
			this.cboClearCntClr.Location = new System.Drawing.Point(128, 32);
			this.cboClearCntClr.Name = "cboClearCntClr";
			this.cboClearCntClr.Size = new System.Drawing.Size(144, 23);
			this.cboClearCntClr.TabIndex = 4;
			this.cboClearCntClr.SelectedIndexChanged += new System.EventHandler(this.cboClearCntClr_SelectedIndexChanged);
			// 
			// label3
			// 
			this.label3.AutoSize = true;
			this.label3.Location = new System.Drawing.Point(16, 76);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(42, 14);
			this.label3.TabIndex = 1;
			this.label3.Text = "Mode :";
			// 
			// label4
			// 
			this.label4.AutoSize = true;
			this.label4.Location = new System.Drawing.Point(16, 36);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(88, 14);
			this.label4.TabIndex = 0;
			this.label4.Text = "Clear Counter :";
			// 
			// btnReturn
			// 
			this.btnReturn.Location = new System.Drawing.Point(184, 287);
			this.btnReturn.Name = "btnReturn";
			this.btnReturn.Size = new System.Drawing.Size(128, 32);
			this.btnReturn.TabIndex = 1;
			this.btnReturn.Text = "Return";
			this.btnReturn.Click += new System.EventHandler(this.btnReturn_Click);
			// 
			// LtcClrSet
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(328, 334);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.btnReturn,
																		  this.groupBox2,
																		  this.groupBox1});
			this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "LtcClrSet";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "LTC/CLR Setting";
			this.Load += new System.EventHandler(this.LtcClrSet_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void btnReturn_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void cboClearCntLtc_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			Setting.ClearCntLtc = (short)cboClearCntLtc.SelectedIndex;
		}

		private void cboLtcMode_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			Setting.LtcMode = (short)cboLtcMode.SelectedIndex;
		}

		private void cboClearCntClr_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			Setting.ClearCntClr = (short)cboClearCntClr.SelectedIndex;
		}

		private void cboClrMode_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			Setting.ClrMode = (short)cboClrMode.SelectedIndex;
		}

		private void LtcClrSet_Load(object sender, System.EventArgs e)
		{
			// ComboBox
			cboClearCntLtc.Items.Clear();
			cboClearCntLtc.Items.Add("No Clear");
			cboClearCntLtc.Items.Add("OutPulse");
			cboClearCntLtc.Items.Add("EncoderPulse");
			cboClearCntLtc.Items.Add("Out & EncoderPulse");

			// ComboBox
			cboLtcMode.Items.Clear();
			cboLtcMode.Items.Add("No Use");
			cboLtcMode.Items.Add("OutPulse");
			cboLtcMode.Items.Add("EncoderPulse");
			cboLtcMode.Items.Add("Out & EncoderPulse");

			// ComboBox
			cboClearCntClr.Items.Clear();
			cboClearCntClr.Items.Add("No Clear");
			cboClearCntClr.Items.Add("OutPulse");
			cboClearCntClr.Items.Add("EncoderPulse");
			cboClearCntClr.Items.Add("Out & EncoderPulse");

			// ComboBox
			cboClrMode.Items.Clear();
			cboClrMode.Items.Add("No Use");

			// ComboBox Initialise
			cboClearCntLtc.SelectedIndex = Setting.ClearCntLtc;
			cboLtcMode.SelectedIndex = Setting.LtcMode;
			cboClearCntClr.SelectedIndex = Setting.ClearCntClr;
			cboClrMode.SelectedIndex = Setting.ClrMode;
		}
	}
}
